<template>
	<view class="tapconter">
		<view class="tap-box" v-for="(item,index) in caseList" :key="index" @click="gowelfared(item.id)">
			<view class="tbox-left">
				<image :src="item.imgs[0]" mode=""></image>
			</view>
			<view class="tbox-right">
				<view class="tit">{{item.title}}</view>
				<view class="box-ti">
					<view class="">
						<image src="../../static/img/gy (7).png" mode=""></image>
					</view>
					<view class="hang">已有 <text class="du">{{item.viewnum}}</text> 人贡献了爱心</view>
				</view>
				<view class="jt-wz">
					{{item.description}}
				</view>
			</view>
		</view>
		<u-empty mode="list" v-if="caseList.length <= 0"></u-empty>
	</view>
</template>

<script>
	import {
		request
	} from "@/request/index.js"
	import regeneratorRuntime from '@/lib/runtime/runtime';
	import tabBar from '@/components/tabBar/tabBar.vue'
	export default {

		data() {
			return {
				title: '项目列表',
				qhindex: 0,
				caseNav: [],
				caseList: [],
				page: 1,
				num: 5,
				totalPages: 0,
			}
		},

		onPullDownRefresh() {
			uni.showLoading()
			setTimeout(() => {
				uni.hideLoading()
				uni.stopPullDownRefresh()
			}, 500)
		},
		onReachBottom() {
			console.log(111)
			if (this.page > this.totalPages) {
				uni.showToast({
					title: '没有下一页数据',
					icon: 'none'
				})

			} else {
				this.page++
				console.log(2122)
				this.GetCaseList()
			}
		},

		components: {

		},
		onLoad() {
			this.GetCaseList()
		},
		onShow() {
			this.GetCaseList()
		},
		methods: {

			getqh(index, id) {

				this.qhindex = id
				this.caseList = []
				this.GetCaseList()
			},
			// 项目 
			async GetCaseList() {
				var res3 = await request({
					url: "GetMyJoinCase?page=" + this.page + "&num=" + this.num,
				});
				if (res3.code == 0) {
					if (this.page != 1) {
						this.caseList = this.caseList.concat(res3.data)
					} else {
						this.caseList = res3.data
					}
					let total = res3.count
					this.totalPages = Math.ceil(total / this.num);
				}

			},
			// 项目分类
			async initPageDate() {


				// 
				var res3 = await request({
					url: "GetClassification?id=74",
				});
				if (res3.code == 0) {
					this.caseNav = res3.data
				}




			},
		}
	}
</script>

<style scoped lang="scss">
	.tapconter {
		width: 100%;
		background-color: white;
		box-sizing: border-box;
		padding-bottom: 20rpx;
		padding-left: 20rpx;
		position: relative;
		margin-bottom: 20rpx;
	}

	.tap-top {
		margin-top: 20rpx;
		width: 100%;
		// padding-bottom: 22rpx;
		box-sizing: border-box;
		border-bottom: 1px solid #EEEEEE;
		white-space: nowrap;



		.sz {
			text-align: center;
			display: inline-block;
		}

		.box {
			// margin: 0 auto;
			text-align: center;
			font-size: 32rpx;
			// margin-right: 50rpx;
			padding: 0 20rpx;
			line-height: 32rpx;
			text-align: center;
			// font-weight: bold;
			color: #666666;
			margin-bottom: 22rpx;
		}
	}

	.xztap {
		color: #333333 !important;
		font-weight: bold !important;
	}

	.gang {
		height: 8rpx;
		background: #0DC06E;
		border-radius: 14rpx;
	}

	.tap-box {
		height: 236rpx;
		width: 100%;
		box-sizing: border-box;
		border-bottom: 2rpx solid #EEEEEE;
		display: flex;
		padding: 30rpx 0px;
	}

	.tbox-left {
		width: 280rpx;
		height: 176rpx;
		border-radius: 10rpx;
		overflow: hidden;
		margin-right: 20rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.tbox-right {
		width: 55%;

		.tit {
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
			overflow: hidden;
			text-overflow: ellipsis;
			-webkit-line-clamp: 2;
			display: -webkit-box;
			-webkit-box-orient: vertical;
		}

		.box-ti {
			margin: 16rpx 0px;
			display: flex;

			image {
				width: 28px;
				height: 28px;
				margin-right: 10rpx;
			}

			.hang {
				font-size: 24rpx;
				color: #999999;
			}

			.du {
				color: #0DC06E;
				font-size: 24rpx;
			}
		}

		.jt-wz {
			font-size: 28rpx;
			font-weight: 400;
			color: #666666;
			line-height: 33rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			-webkit-line-clamp: 2;
			display: -webkit-box;
			-webkit-box-orient: vertical;
		}
	}
</style>